package org.zfes.snowier.cloud.zbss.cms.router.service.topic;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.topic.model.CmsTopicContent;
import org.zfes.snowier.cloud.zbss.cms.topic.service.ICmsTopicContentService;
@Controller 
@RequestMapping("/cms/topic/cmsTopicContent")
public class CmsTopicContentController extends BaseController {

	
	@Autowired
	private ICmsTopicContentService cmsTopicContentService;
	
	@RequiresPermissions(value="cmsTopicContent:loadCmsTopicContentDataSet",desc="专题内容列表")
    @RequestMapping(value="/loadCmsTopicContentDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsTopicContentDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsTopicContentService.loadCmsTopicContentDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsTopicContent:createCmsTopicContent",desc="专题内容添加")
    @RequestMapping(value="/createCmsTopicContent", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsTopicContent(CmsTopicContent cmsTopicContent){
		cmsTopicContentService.createCmsTopicContent(cmsTopicContent);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsTopicContent:loadCmsTopicContent",desc="专题内容加载")
    @RequestMapping(value="/loadCmsTopicContent", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsTopicContent(Long id){
		Optional<CmsTopicContent> ops = cmsTopicContentService.loadCmsTopicContentById(id);
		return ajaxQuery("cmsTopicContent",ops);
    }
	
	@RequiresPermissions(value="cmsTopicContent:updateCmsTopicContent",desc="专题内容更新")
    @RequestMapping(value="/updateCmsTopicContent", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsTopicContent(CmsTopicContent cmsTopicContent){
		cmsTopicContentService.updateCmsTopicContent(cmsTopicContent);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsTopicContent:deletCmsTopicContent",desc="专题内容删除")
    @RequestMapping(value="/deleteCmsTopicContent", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsTopicContent(Long id){
		cmsTopicContentService.deleteCmsTopicContent(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}